from django.db import models
from department.models import Department
from user.models import User

# Create your models here.


class Notice(models.Model):
    title = models.CharField('标题', max_length=100,default=None)
    content = models.TextField('内容')
    release_time = models.DateTimeField('发布时间', auto_now_add=True, null=True)
    updated_time = models.DateTimeField('更新时间', auto_now=True, null=True)
    delete_or_not = models.BooleanField('是否删除', default=False, null=True)
    preferred_grade = models.CharField('优先级', max_length=50, default=None,null=True)
    user_type = models.CharField('用户类型', max_length=50, default=None, null=True)
    read_or_not = models.BooleanField('是否阅读', default=False, null=True)
    read_time = models.DateTimeField('阅读时间', auto_now=True, null=True)
    # 关联user表,部门表/
    user = models.ForeignKey(User, on_delete=models.CASCADE, default=None)
    department = models.ForeignKey(Department, on_delete=models.CASCADE, default=None)